<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>rsync定时同步+异地备份 | 清峰小栈</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="rsync" />
  
  
  
  
  <meta name="description" content="Rsync定时同步+异地备份​	简介：Rsync是unix系统下的一个数据备份工具。可实现本地文件的拷贝，与远程文件的同步传输。  特点： 1、Rsync安装便捷，使用方便。 2、传输过程中以压缩解压形式，减少带宽占用。 3、能更新整个文件数。 4、安全，能用 rsh、ssh 或直接端口做为传输端口，或者 socket 连接。 5、亮点是免费。  ​	简单来讲Rcync的目的是实现两台主机上的文件">
<meta property="og:type" content="article">
<meta property="og:title" content="Rsync定时同步+异地备份">
<meta property="og:url" content="http://example.com/2021/08/17/Linux/Rsync%E5%AE%9A%E6%97%B6%E5%90%8C%E6%AD%A5+%E5%BC%82%E5%9C%B0%E5%A4%87%E4%BB%BD/index.html">
<meta property="og:site_name" content="清峰小栈">
<meta property="og:description" content="Rsync定时同步+异地备份​	简介：Rsync是unix系统下的一个数据备份工具。可实现本地文件的拷贝，与远程文件的同步传输。  特点： 1、Rsync安装便捷，使用方便。 2、传输过程中以压缩解压形式，减少带宽占用。 3、能更新整个文件数。 4、安全，能用 rsh、ssh 或直接端口做为传输端口，或者 socket 连接。 5、亮点是免费。  ​	简单来讲Rcync的目的是实现两台主机上的文件">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817163014388.png">
<meta property="og:image" content="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817100515149.png">
<meta property="og:image" content="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817170139997.png">
<meta property="og:image" content="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817102358753.png">
<meta property="og:image" content="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817171925808.png">
<meta property="og:image" content="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817172033045.png">
<meta property="article:published_time" content="2021-08-17T09:50:44.000Z">
<meta property="article:modified_time" content="2023-05-03T13:56:40.691Z">
<meta property="article:author" content="清峰">
<meta property="article:tag" content="rsync">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817163014388.png">
  

  

  <link rel="icon" href="/qingfeng-blog/css/images/mylogo-2.png">
  <link rel="apple-touch-icon" href="/qingfeng-blog/css/images/mylogo-2.png">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <!-- <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> -->
  <link href="/qingfeng-blog/css/font-awesome.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt; src:url("/qingfeng-blog/css/fonts/FuturaPTBold.otf") format("woff");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt-light; src:url("/qingfeng-blog/css/fonts/FuturaPTBook.otf") format("woff");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt-italic; src:url("/qingfeng-blog/css/fonts/FuturaPTBookOblique.otf") format("woff");font-weight:400;font-style:italic;}
}

  </style>
  
<link rel="stylesheet" href="/qingfeng-blog/css/style.css">


  
<script src="/qingfeng-blog/js/jquery-3.1.1.min.js"></script>

  
<script src="/qingfeng-blog/js/bootstrap.js"></script>


  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/qingfeng-blog/css/bootstrap.css" >

  
    
<link rel="stylesheet" href="/qingfeng-blog/css/dialog.css">

  

  

  
    <link rel="stylesheet" href="/qingfeng-blog/css/header-post.css" >
  

  
  
  
    <link rel="stylesheet" href="/qingfeng-blog/css/vdonate.css" >
  

<meta name="generator" content="Hexo 6.3.0"></head>



  <body data-spy="scroll" data-target="#toc" data-offset="50">


  
  <div id="container">
    <div id="wrap">
      
        <header>

    <div id="allheader" class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="navbar-inner">
          
          <div class="container"> 
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>

            
              <a class="brand" style="
                 border-width: 0px;  margin-top: 0px;"  
                href="#" data-toggle="modal" data-target="#myModal" >
                  <img width="155px" height="90px" alt="Hike News" src="/qingfeng-blog/css/images/mylogo-2.png">
              </a>
            
            
            <div class="navbar-collapse collapse">
              <ul class="hnav navbar-nav">
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/">首页</a> </li>
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/categories">分类</a> </li>
                
                  <li> <a class="main-nav-link" href="/qingfeng-blog/tags">标签</a> </li>
                
                  <li><div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="Type something..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: 'Posts',
            PAGES: 'Pages',
            CATEGORIES: 'Categories',
            TAGS: 'Tags',
            UNTITLED: '(Untitled)',
        },
        ROOT_URL: '/qingfeng-blog/',
        CONTENT_URL: '/qingfeng-blog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/qingfeng-blog/js/insight.js"></script>


</div></li>
            </div>
          </div>
                
      </div>
    </div>

</header>



      
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Linux/Rsync定时同步+异地备份" style="width: 75%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
<div id="container">
  <div id="articleInner" class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      Rsync定时同步+异地备份
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	<a href="/qingfeng-blog/2021/08/17/Linux/Rsync%E5%AE%9A%E6%97%B6%E5%90%8C%E6%AD%A5+%E5%BC%82%E5%9C%B0%E5%A4%87%E4%BB%BD/" class="article-date">
	  <time datetime="2021-08-17T09:50:44.000Z" itemprop="datePublished">2021-08-17</time>
	</a>

      
    <a class="article-category-link" href="/qingfeng-blog/categories/Linux/">Linux</a>

      
	<a class="article-views">
	<span id="busuanzi_container_page_pv">
		PV:<span id="busuanzi_value_page_pv"></span>
	</span>
	</a>

      

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="Rsync定时同步-异地备份"><a href="#Rsync定时同步-异地备份" class="headerlink" title="Rsync定时同步+异地备份"></a>Rsync定时同步+异地备份</h1><p>​	<strong>简介：Rsync是unix系统下的一个数据备份工具。可实现本地文件的拷贝，与远程文件的同步传输。</strong></p>
<blockquote>
<p>特点：</p>
<p>1、Rsync安装便捷，使用方便。</p>
<p>2、传输过程中以压缩解压形式，减少带宽占用。</p>
<p>3、能更新整个文件数。</p>
<p>4、安全，能用 rsh、ssh 或直接端口做为传输端口，或者 socket 连接。</p>
<p>5、亮点是免费。</p>
</blockquote>
<p>​	简单来讲Rcync的目的是实现两台主机上的文件同步。（包括本机推送远程文件，远程拉取本机文件两种方式）</p>
<p>​	嗯哼，两台主机的文件同步这就涉及到了，源服务器和目标服务器了。</p>
<p>以你要同步的文件为基准，要同步的文件在A服务器，A服务器就作为源服务器。B服务器就是目标服务器。</p>
<p>​	<strong>理解了主次，需求就来了：我们需要将A服务器上的某个文件，同步到B服务器上的某个文件夹下，如何实现？</strong></p>
<p>​	</p>
<p>​	以Centos为例：</p>
<p>1、输入rsync，查看系统是否安装了该工具。</p>
<p>2、没有安装则手动安装。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install rsync -y</span><br></pre></td></tr></table></figure>

<p><strong>扩展</strong></p>
<p>rsync具有本地文件拷贝功能。</p>
<p>本地文件同步类似拷贝命令cp，将a文件夹同步到b文件夹</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rsync -源文件夹 源路径  目标路径</span><br><span class="line">rsync -a /tmp/a/  /tmp/b</span><br></pre></td></tr></table></figure>

<p>参数：-a存档  -av存档并去重</p>
<h3 id="一、以ssh-ip直连的方式实现文件同步。"><a href="#一、以ssh-ip直连的方式实现文件同步。" class="headerlink" title="一、以ssh ip直连的方式实现文件同步。"></a>一、以ssh ip直连的方式实现文件同步。</h3><p><img src="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817163014388.png" alt="image-20210817163014388"></p>
<p>以ssh方式连接需要密码：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">rsync -av -e &quot;ssh -p 端口号&quot; 源文件夹  目标用户@目标ip:目标文件夹（将a文件夹的文件同步到c文件夹下）</span><br><span class="line">rsync -av -e &quot;ssh -p 22&quot; /tmp/a/  root@192.168.241:/tmp/c</span><br></pre></td></tr></table></figure>

<h3 id="二、以模块组件方式实现文件同步。"><a href="#二、以模块组件方式实现文件同步。" class="headerlink" title="二、以模块组件方式实现文件同步。"></a>二、以模块组件方式实现文件同步。</h3><p>Rsync可以作为一个服务器，同其他Rsync组件进行远程连接</p>
<p>在源服务器上安装好Rsync后，启动</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">yum -y install rsync xinetd</span><br><span class="line">两种启动方式：</span><br><span class="line">(1)独立启动 /usr/bin/rsync –-daemon</span><br><span class="line">(2)用xinetd超级进程启动/etc/rc.d/init.d/xinetd reload</span><br><span class="line"></span><br><span class="line">扩展：</span><br><span class="line">rsync默认端口：837</span><br><span class="line">/usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf 　#--config用于指定rsyncd.conf的位置,如果在/etc下可以不写</span><br></pre></td></tr></table></figure>

<p><strong>1、不受密码保护的方式</strong></p>
<p>1）写入配置文件：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">#创建 rsyncd.conf，这是 rsync 服务器的配置文件</span><br><span class="line">vi /etc/rsyncd.conf </span><br><span class="line"></span><br><span class="line">#模块名</span><br><span class="line">[mag_sync]</span><br><span class="line">#源文件路径</span><br><span class="line">path = /usr/local/mongodb/data/auditLog</span><br><span class="line">是否允许客户端可以查看可用模块列表，默认为可以</span><br><span class="line">list = yes</span><br><span class="line">#是否只读</span><br><span class="line">read only = no</span><br><span class="line">#忽略错误</span><br><span class="line">ignore errors</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>2）查看模块  rsync 124.71.8.140::</p>
<p>3）查看模块下绑定文件夹中的文件 rsync 124.71.8.140::mag_sync</p>
<p>4）拉取模块下绑定的文件夹到目标文件夹下  rsync -av 124.71.8.140::mag_sync  &#x2F;root&#x2F;data&#x2F;mongologs&#x2F;</p>
<p><img src="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817100515149.png" alt="image-20210817100515149"></p>
<p>可以看到文件同步完毕</p>
<p><strong>2、受密码保护的方式</strong></p>
<p>1）修改配置文件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">#用户</span><br><span class="line">uid = root </span><br><span class="line">#用户组</span><br><span class="line">gid = root</span><br><span class="line">#日志文件路径</span><br><span class="line">log file = /var/log/rsyncd.log</span><br><span class="line">secrets file = /etc/rsyncd/rsyncd.secrets</span><br><span class="line">#模块名</span><br><span class="line">[mag_sync]</span><br><span class="line">#源文件路径</span><br><span class="line">path = /usr/local/mongodb/data/auditLog</span><br><span class="line">是否允许客户端可以查看可用模块列表，默认为可以</span><br><span class="line">list = yes</span><br><span class="line">#是否只读</span><br><span class="line">read only = no</span><br><span class="line">#忽略错误</span><br><span class="line">ignore errors</span><br><span class="line">#认证用户</span><br><span class="line">auth users =root</span><br></pre></td></tr></table></figure>

<p>2）添加密码：vi &#x2F;etc&#x2F;rsyncd&#x2F;rsyncd.secrets</p>
<p>用户名:密码</p>
<p><img src="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817170139997.png" alt="image-20210817170139997"></p>
<p>3）给权限</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod 600 /etc/rsyncd/rsyncd.secrets</span><br></pre></td></tr></table></figure>

<p>4）测试（目标服务器连接时需要密码输入）</p>
<p>rsync <a href="mailto:&#114;&#x6f;&#111;&#x74;&#64;&#x31;&#x32;&#x34;&#x2e;&#55;&#49;&#46;&#56;&#46;&#x31;&#52;&#48;">&#114;&#x6f;&#111;&#x74;&#64;&#x31;&#x32;&#x34;&#x2e;&#55;&#49;&#46;&#56;&#46;&#x31;&#52;&#48;</a>::mag_sync</p>
<p><img src="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817102358753.png" alt="image-20210817102358753"></p>
<p>3、目标服务器调用源服务器拉取文件，自动获取密码配置</p>
<p>1）在目标服务器保存密码</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">vi /etc/rsync.password</span><br><span class="line"></span><br><span class="line">Zz@1qaz2wsx</span><br></pre></td></tr></table></figure>

<p>2）给权限:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod 600 /etc/rsync.password</span><br></pre></td></tr></table></figure>

<p>3）拉取源文件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">远程调用：rsync --password-file=密码存放路径 用户名@源服务器ip::模块名 要保存在哪个文件夹路径下</span><br><span class="line">rsync -av --password-file=/etc/rsync.password root@124.71.8.140::mag_sync /root/data/mongologs/</span><br></pre></td></tr></table></figure>



<h3 id="三、定期实现文件同步"><a href="#三、定期实现文件同步" class="headerlink" title="三、定期实现文件同步"></a>三、定期实现文件同步</h3><p>​	<strong>需求：让rsync 客户端自动与服务器同步数据</strong></p>
<p>​	思路：</p>
<p>​	1、编写一个拉取源文件的脚本。（rsync）</p>
<p>​	2、开一个定时任务，定期执行该脚本。（cron 系统调度进程）</p>
<p>​	<strong>crontab命令用于设置周期性被执行的指令</strong>。该命令从标准输入设备读取指令，并将其存放于“crontab”文件中，以供之后读取和执行。</p>
<p>​	1、检查是否安装了crontab，如果提示未安装请自行安装</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa | grep crontab</span><br><span class="line"></span><br><span class="line">#vixie-cron软件包是cron的主程序； </span><br><span class="line">#crontabs软件包是用来安装、卸装、或列举用来驱动 cron 守护进程的表格的程序。</span><br><span class="line">yum install  vixie-cron</span><br><span class="line">yum install  crontabs  (centos安装指令)</span><br><span class="line"></span><br><span class="line">#安装完以后开启crontab服务</span><br><span class="line">service crond start</span><br></pre></td></tr></table></figure>

<blockquote>
<p>service crond start &#x2F;&#x2F;启动服务<br>service crond stop &#x2F;&#x2F;关闭服务<br>service crond restart &#x2F;&#x2F;重启服务<br>service crond reload &#x2F;&#x2F;重新载入配置</p>
<p>查看crontab服务状态：service crond status </p>
</blockquote>
<p>​	2、新增调度任务可用两种方法： </p>
<p>​	先新建一个脚本文件：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">vi /root/data/pulllog.sh</span><br><span class="line">rsync -av --password-file=/etc/rsync.password root@124.71.8.140::mag_sync /root/data/mongologs/</span><br><span class="line"></span><br><span class="line">默认创建的这个sh问件是没有执行权限的，修改权限</span><br><span class="line">chmod 777 pulllog.sh</span><br></pre></td></tr></table></figure>



<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">分  时 天 月 星期  以root用户身份来运行  执行的脚本路径</span><br><span class="line">*   *  *  *  *     root              /root/data/pulllog.sh</span><br></pre></td></tr></table></figure>

<p>​	1)、在命令行输入: crontab -e 然后添加相应的任务，wq存盘退出。</p>
<p><img src="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817171925808.png" alt="image-20210817171925808"> </p>
<p>​	2)、直接编辑&#x2F;etc&#x2F;crontab 文件，即vi &#x2F;etc&#x2F;crontab，添加相应的任务。 </p>
<p><img src="https://gitee.com/lindaifeng/my-images/raw/master/img/image-20210817172033045.png" alt="image-20210817172033045"></p>
<blockquote>
<p>crontab -e配置是针对某个用户的，而编辑&#x2F;etc&#x2F;crontab是针对系统的任务<br>查看调度任务<br>crontab -l &#x2F;&#x2F;列出当前的所有调度任务<br>crontab -l -u jp &#x2F;&#x2F;列出用户jp的所有调度任务 </p>
<p>crontab -r &#x2F;&#x2F;删除所有任务调度工作 </p>
</blockquote>
<p>​	3）查看调度任务 </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">crontab -l</span><br></pre></td></tr></table></figure>

<p>​	没有的话重启服务</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">service crond restart</span><br></pre></td></tr></table></figure>

<p>​	如果有错，Linux会在执行的时候发送一份邮件给你</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /var/spool/mail/root</span><br></pre></td></tr></table></figure>



<p>至此文件定期执行脚本拉取源文件同步到新文件夹中就实现了</p>

      
    </div>
    <footer class="article-footer">
      
        <div id="donation_div"></div>


<script src="/qingfeng-blog/js/vdonate.js"></script>

<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: 'http://img.lindaifeng.vip/typora-picgo-tuchaung/20230428150832.png',
  alipayImage: 'http://img.lindaifeng.vip/typora-picgo-tuchaung/20230428150823.png'
});
</script>
      
      
      <div>
        <ul class="post-copyright">
          <li class="post-copyright-author">
          <strong>Post author:  </strong>清峰</a>
          </li>
          <li class="post-copyright-link">
          <strong>Post link:  </strong>
          <a href="/qingfeng-blog/2021/08/17/Linux/Rsync定时同步+异地备份/" target="_blank" title="Rsync定时同步+异地备份">http://example.com/2021/08/17/Linux/Rsync定时同步+异地备份/</a>
          </li>
          <li class="post-copyright-license">
            <strong>Copyright Notice:   </strong>
            All articles in this blog are licensed under <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">CC BY-NC-ND 4.0</a>
            unless stating additionally.
          </li>
         
        </ul>
<div>

      
      
        
	<div id="comment">
		<!-- 来必力City版安装代码 -->
		<div id="lv-container" data-id="city" data-uid="MTAyMC8yOTQ4MS82MDQ5">
		<script type="text/javascript">
		   (function(d, s) {
		       var j, e = d.getElementsByTagName(s)[0];

		       if (typeof LivereTower === 'function') { return; }

		       j = d.createElement(s);
		       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
		       j.async = true;

		       e.parentNode.insertBefore(j, e);
		   })(document, 'script');
		</script>
		<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
		</div>
		<!-- City版安装代码已完成 -->
	</div>



      
      
        
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/qingfeng-blog/tags/rsync/" rel="tag">rsync</a></li></ul>

      

    </footer>
  </div>
</div>
  
    
<nav id="article-nav">
  
    <a href="/qingfeng-blog/2021/09/11/%E8%BF%90%E7%BB%B4%E5%AE%89%E8%A3%85/Linux%E5%AE%89%E8%A3%85mysql/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Linux安装mysql
        
      </div>
    </a>
  
  
    <a href="/qingfeng-blog/2021/07/08/Mysql/MySql%E5%BC%80%E5%90%AFSSL%E5%AE%89%E5%85%A8%E8%AE%A4%E8%AF%81/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">MySql开启SSL安全认证</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="toc-sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
        <ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Rsync%E5%AE%9A%E6%97%B6%E5%90%8C%E6%AD%A5-%E5%BC%82%E5%9C%B0%E5%A4%87%E4%BB%BD"><span class="nav-number">1.</span> <span class="nav-text">Rsync定时同步+异地备份</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E4%BB%A5ssh-ip%E7%9B%B4%E8%BF%9E%E7%9A%84%E6%96%B9%E5%BC%8F%E5%AE%9E%E7%8E%B0%E6%96%87%E4%BB%B6%E5%90%8C%E6%AD%A5%E3%80%82"><span class="nav-number">1.0.1.</span> <span class="nav-text">一、以ssh ip直连的方式实现文件同步。</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E4%BB%A5%E6%A8%A1%E5%9D%97%E7%BB%84%E4%BB%B6%E6%96%B9%E5%BC%8F%E5%AE%9E%E7%8E%B0%E6%96%87%E4%BB%B6%E5%90%8C%E6%AD%A5%E3%80%82"><span class="nav-number">1.0.2.</span> <span class="nav-text">二、以模块组件方式实现文件同步。</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E5%AE%9A%E6%9C%9F%E5%AE%9E%E7%8E%B0%E6%96%87%E4%BB%B6%E5%90%8C%E6%AD%A5"><span class="nav-number">1.0.3.</span> <span class="nav-text">三、定期实现文件同步</span></a></li></ol></li></ol></li></ol>
    
    </div>
  </aside>


</section>
        
      </div>
      
      <footer id="footer">
  

  <div class="container">
      	<div class="row">
	      <!-- <p> Powered by <a href="http://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/iTimeTraveler/hexo-theme-hiker" target="_blank">Hexo-theme-hiker</a> </p> -->
	      <p>May there be no bug in the world！</p>
        <p id="copyRightEn">Copyright &copy; 2022 - 2023 All Rights Reserved.</p>
	      
	      
    		<p class="busuanzi_uv">
				UV : <span id="busuanzi_value_site_uv"></span> |  
				PV : <span id="busuanzi_value_site_pv"></span>
		    </p>
  		   
		</div>

		
  </div>
</footer>


<!-- min height -->

<script>
    var wrapdiv = document.getElementById("wrap");
    var contentdiv = document.getElementById("content");
    var allheader = document.getElementById("allheader");

    wrapdiv.style.minHeight = document.body.offsetHeight + "px";
    if (allheader != null) {
      contentdiv.style.minHeight = document.body.offsetHeight - allheader.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    } else {
      contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    }
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/qingfeng-blog/" class="mobile-nav-link">首页</a>
  
    <a href="/qingfeng-blog/categories" class="mobile-nav-link">分类</a>
  
    <a href="/qingfeng-blog/tags" class="mobile-nav-link">标签</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  
<link rel="stylesheet" href="/qingfeng-blog/fancybox/jquery.fancybox.css">

  
<script src="/qingfeng-blog/fancybox/jquery.fancybox.pack.js"></script>




<script src="/qingfeng-blog/js/scripts.js"></script>



  
<script src="/qingfeng-blog/js/home.js"></script>




  
<script src="/qingfeng-blog/js/dialog.js"></script>









	<div style="display: none;">
    <script src="https://s95.cnzz.com/z_stat.php?id=1260716016&web_id=1260716016" language="JavaScript"></script>
  </div>



	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h2 class="modal-title" id="myModalLabel">设置</h2>
      </div>
      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">


      <div class="modal-body">
          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" onclick="javascript:setFontSize();" aria-expanded="true" aria-controls="collapseOne">
              正文字号大小
            </a>
          </div>
          <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
          <div class="panel-body">
            您已调整页面字体大小
          </div>
        </div>
      


          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" onclick="javascript:setBackground();" aria-expanded="true" aria-controls="collapseTwo">
              夜间护眼模式
            </a>
        </div>
          <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
          <div class="panel-body">
            夜间模式已经开启，再次单击按钮即可关闭 
          </div>
        </div>

        <div>
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关 于&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
        </div>
         <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
          <div class="panel-body">
            清峰小栈
          </div>
          <div class="panel-body">
            Copyright © 2023 清峰 All Rights Reserved.
          </div>
        </div>
      </div>


      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <div class="modal-footer">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
      </div>
    </div>
  </div>
</div>
  
  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/qingfeng-blog/js/totop.js?v=1.0.0" async=""></script>
  
    <a id="menu-switch"><i class="fa fa-bars fa-lg"></i></a>
  
</body>
</html>